/**
 * Created by hxpeng on 2017/3/24.
 */
(function () {
    'use strict';

    angular.module('App.pages.member', [
        'App.pages.member.bind',
        'App.pages.member.entrust',
        'App.pages.member.msg'
    ]).config(routeConfig);

    function routeConfig($stateProvider) {
        $stateProvider.state('memberMenu', {
            url: "/member",
            abstract: true,
            templateUrl: 'source/pages/page-tab.html',
        }).state('memberMenu.teacherIndex', {
            url: "/teacherIndex",
            views: {
                'kinder-view': {
                    templateUrl: 'source/pages/member/teacher/index.html',
                    controller:'TeacherCtrl as vm'
                }
            }
        }).state('memberMenu.parentIndex', {
            url: "/parentIndex",
            views: {
                'kinder-view': {
                    templateUrl: 'source/pages/member/parent/index.html',
                    controller:'ParentCtrl as vm'
                }
            }
        }).state('memberMenu.studentIndex', {
            url: "/studentIndex/{studentId:string}",
            cache: false,
            params: {
                studentId: null
            },
            views: {
                'kinder-view': {
                    templateUrl: 'source/pages/member/student/index.html',
                    controller:'StudentCtrl as vm',
                    resolve: {
                        studentId: function($stateParams){
                            return $stateParams.studentId;
                        }
                    }
                }
            }
        }).state('memberMenu.parentInfo', {
            url: "/parentInfo/{studentId:string}",
            params: {
                studentId: null
            },
            views: {
                'kinder-view': {
                    templateUrl: 'source/pages/member/parent/parent-info.html',
                    controller:'ParentInfoCtrl as vm',
                    resolve: {
                        studentId: function($stateParams){
                            return $stateParams.studentId;
                        }
                    }
                }
            }
        }).state('memberMenu.leaveMsg', {
            url: "/leaveMsg/{toMemberId:string}",
            params:{
                toMemberId:null
            },
            views: {
                'kinder-view': {
                    templateUrl: 'source/pages/member/msg/index.html',
                    controller:'MsgCtrl as vm'
                }
            }
        }).state('memberMenu.display', {
            url: "/display",
            views: {
                'kinder-view': {
                    templateUrl: 'source/pages/member/upload/display.html',
                    controller:'DisplayCtrl as vm'
                }
            }
        }).state('memberMenu.upload', {
            url: "/upload",
            views: {
                'kinder-view': {
                    templateUrl: 'source/pages/member/upload/upload.html',
                    controller:'UploadCtrl as vm'
                }
            }
        });
    }
})();